package test.ground.elasticjob;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.dataflow.DataflowJob;

import java.util.List;

/**
 * @Author wangshaopeng
 * @Date 2020/12/30
 */
public class MyDataFlowJob implements DataflowJob<String> {

    @Override

    public List<String> fetchData(ShardingContext shardingContext) {
        List<String> users = null;

        /**
         * users = SELECT * FROM user WHERE status = 0 AND MOD(id, shardingTotalCount) = shardingItem Limit 0, 30
         */

        return users;

    }



    @Override
     public void processData(ShardingContext shardingContext, List<String> data) {

        for (String user: data) {

            System.out.println(String.format("用户 %s 开始计息"));

        }

    }

}
